﻿using AnesSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AnesSystem.ViewModels
{
    public abstract class MainPageCommonViewModel: ViewModel
    {
        #region Variables

        private static MainPageCommonViewModel _instance;
        private Visibility waitCtrlVisibility = Visibility.Collapsed;
        private string defaultMessage = "loading...";
        private string waitMessage = "";

        #endregion

        #region Constructor

        public MainPageCommonViewModel()
        {
            IsShowTimeOutDialog = false;
            waitMessage = defaultMessage;
        }


        #endregion

        #region Properties

        public static MainPageCommonViewModel Instance
        {
            get
            {
                if (_instance == null)
                {
                    //新版本
                    _instance = new CommonPageViewModel();
                    //老版本
                    //_instance = new SysMainWinViewModel();
                }
                return _instance;
            }
        }

        public bool IsShowTimeOutDialog { get; set; }



        public ConfigOperationRoomModel CurrentRoom
        {
            get
            {
                return DataManager.Instance.CurRoom;
            }
            set
            {
                RaisePropertyChanged("CurrentRoom");
            }
        }

        public AccountModel CurrentAccount
        {
            get
            {
                return DataManager.Instance.Login;
            }
            set
            {
                RaisePropertyChanged("CurrentAccount");
            }
        }

        public Visibility WaitCtrlVisibility
        {
            get
            {
                return waitCtrlVisibility;
            }

            set
            {
                if (value == Visibility.Collapsed)
                    WaitMessage = defaultMessage;
                waitCtrlVisibility = value;
                RaisePropertyChanged("WaitCtrlVisibility");
            }
        }

        public string WaitMessage
        {
            get
            {
                return waitMessage;
            }

            set
            {
                waitMessage = value;
                RaisePropertyChanged("WaitMessage");
            }
        }

        #endregion

        #region Event

        #endregion

        #region Private Methods


        #endregion

        #region Public/Protected Methods

        public abstract void ReMsg();

        public abstract void NavigateTo(string pageName, bool isMenuClick = true);

        #endregion

        #region EventHandlers

        #endregion
    }
}
